Transcoder

ABSTRACT

A technique for suppressing a significant variation of a quantization step value and enabling a stable rate control to be performed. A function is used for calculating a quantization step conversion factor from a bit rate ratio is a straight line with an inclination of −1, intersecting a function at a reference point. The function is a monotone decreasing exponential function. A reference bit rate ratio (R 0 ) is expressed as R 0 =T/S by using a total bit rate (S) of a first stream and a total target bit rate (T) of a second stream. The function appropriately represents a relation between the bit rate ratio and the quantization step conversion factor in coding conversion but has a large rate of variation in an area where the bit rate ratio is about 0.5. The function has a small rate of variation and can suppress a significant variation of the quantization step conversion value.

TECHNICAL FIELD

The present invention relates to a transcoder for converting an input stream into a different output stream by decoding, and more particularly to a technique to appropriately control the amount of generated codes of the output stream toward a target bit rate.

BACKGROUND ART

Images to be delivered on digital broadcasts, those to be stored in media such as DVDs and hard disks, and the like are compressed by various coding systems. The object for such compressions is to decrease the burden on a transmission band, increase the transmission speed, decrease the memory size, or the like.

There are various standards for image coding system, such as MPEG2 and H.264. And there is a case where the coding system is changed for the purpose of reducing the amount of codes in a coded image that is inputted, or the like. A transcoder once decodes the inputted coded image. Then, the transcoder encodes the decoded image by a different coding system (or the same coding system) again. Thus, the transcoder controls a bit rate of an output stream.

The following Patent Document 1 discloses a technique for calculating a quantization step value of an output stream in a transcoder. In the following Patent Document 1, the quantization step value is adjusted in consideration of the degree of dispersion of pixels in a macroblock of a decoded image and a motion evaluation value.

-   [Patent Document 1] Japanese Patent Application Laid Open Gazette     No. 2008-42426

In a case where the quantization step value of the output stream is controlled in order to keep the bit rate constant or reduce the bit rate, the variation of the quantization step may increase depending on the condition of an input stream or the calculation condition. When the variation of the quantization step becomes large, a rate control becomes unstable and this causes degradation of image quality.

DISCLOSURE OF INVENTION

The present invention is intended for a transcoder for converting a first stream into a second stream. According to an aspect of the present invention, the transcoder comprises a conversion value calculation part for calculating a quantization step conversion value of the first and second streams from a ratio of bit rates of the first and second streams and a quantization step value calculation part for calculating a quantization step value of the second stream by multiplying a quantization step value of the first stream by the quantization step conversion value, and in the transcoder of the present invention, the conversion value calculation part calculates the quantization step conversion value from the ratio of bit rates by using an area specification function for specifying an area to which a relation between the ratio of bit rates and the quantization step conversion value belongs and a relation determining function for determining a specific relation between the ratio of bit rates and the quantization step conversion value in the area.

With the area specification function, optimal characteristics for coding conversion can be maintained, and with the relation determining function, the variation of the quantization step conversion value can be adjusted.

According to a preferred embodiment of the present invention, assuming that a ratio between a bit rate of a converted first stream in a past period and a target bit rate of a second stream is determined as a current bit rate ratio, in a case where a difference between the quantization step conversion value calculated for the current bit rate ratio by using the area specification function and the quantization step conversion value calculated for the current bit rate ratio by using the relation determining function exceeds a predetermined threshold value, the reference bit rate ratio is updated with the current bit rate ratio.

It is thereby possible to prevent the characteristics of the relation determining function from becoming significantly different from those of the area specification function.

According to another preferred embodiment of the present invention, a rate of change of the relation determining function is smaller than that of the area specification function near the reference bit rate ratio.

With the characteristics of the area specification function, a relation appropriate for coding conversion can be maintained, and with the relation determining function, a significant variation of the quantization step conversion value can be suppressed.

Therefore, it is an object of the present invention to provide a technique for suppressing a significant variation of a quantization step value and enabling a stable rate control to be performed.

These and other objects, features, aspects and advantages of the present invention will become more apparent from the following detailed description of the present invention when taken in conjunction with the accompanying drawings.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram showing a transcoder;

FIG. 2 is a view showing information on an input stream (first stream) and an output stream (second stream) per control unit time;

FIG. 3 is a view showing characteristics of functions f₁ and f₀;

FIG. 4 is a view showing an update of a reference bit rate ratio R₀ and an update of the function f₁;

FIG. 5 is a view showing characteristics of functions f₂ and f₀; and

FIG. 6 is a view showing characteristics of functions f₃ and f₀;

BEST MODE FOR CARRYING OUT THE INVENTION The First Preferred Embodiment

<1. Constitution of Transcoder>

Hereinafter, with reference to figures, the preferred embodiments of the present invention will be discussed. FIG. 1 is a block diagram showing a transcoder 1 in accordance with the preferred embodiments. The transcoder 1 comprises a CPU 11, a decoder 12, an image memory 13, a step value calculation part 14, an encoder 15, and a buffer memory 16.

The decoder 12 inputs a first stream. The first stream is a stream of coded image. The decoder 12 decodes the first stream and outputs uncompressed image data to the image memory 13. The encoder 15 again codes the decoded and uncompressed image data which is stored in the image memory 13, to thereby output a second stream.

The transcoder 1 converts a coding system of stream. For example, the transcoder 1 inputs a first stream coded in MPEG2 and outputs a second stream coded in H.264. Alternatively, the transcoder 1 outputs a stream of the same coding system. For example, the transcoder 1 inputs a first stream coded in MPEG2 and outputs a second stream coded in MPEG2 again.

Various computations performed in the decoder 12, the step value calculation part 14, and the encoder 15 may be implemented by hardware or may be implemented by software operations. In other words, these processing parts may be constructed as hardware circuits or implemented by a CPU and programs stored in memories. Alternatively, there may be a case where some of the computations are performed by hardware and the others are performed by software.

<2. Control Unit Time and Information within Control Unit Time>

FIG. 2 is a view showing information on streams that the transcoder 1 inputs or outputs per control unit time. The transcoder 1 divides the processing time base into control unit times L_(n) (n=1, 2 . . . ) and performs a rate control by using this control unit time L_(n) as a unit of processing. In the following discussion, the control unit time L_(n) is referred to as “the n period” as appropriate. As to the control unit time L_(n), one frame, a plurality of successive frames, one GOP, a plurality of successive GOPs, or the like may be set as one unit time.

A total input bit rate S of the first stream is acquired from a sequence header or the like. An average input bit rate S_(n) is an average bit rate of the first stream in the n period. The transcoder 1 is capable of storing information on the average input bit rates S_(n) for M periods in the buffer memory 16. Specifically, the buffer memory 16 is capable of storing information on the average input bit rates S_(n) from the (n-M+1) period to the n period. An average period bit rate AS_(n) is an average value of the average input bit rates S_(n) from the (n-M+1) period to the n period. The average period bit rate AS_(n) is expressed by Eq. (1).

$\begin{matrix} {{AS}_{n} = {\frac{1}{M}{\sum\limits_{n - M + 1}^{n}\; S_{i}}}} & (1) \end{matrix}$

A total target bit rate T of the second stream is set by a user. For example, the user sets the total target bit rate T by using a not-shown operation part provided in the transcoder 1.

A target setting bit rate T_(n) is a target bit rate of the second stream in the n period. An average output bit rate C_(n) is an average bit rate of the already-converted second stream in the n period. The transcoder 1 is capable of storing information on the average output bit rates C_(n) for M periods in the buffer memory 16. Specifically, the buffer memory 16 is capable of storing information on the average output bit rates C_(n) from the (n-M+1) period to the n period. An average period bit rate AC_(n) is an average value of the average output bit rates C_(n) from the (n-M+1) period to the n period. The average period bit rate AC_(n) is expressed by Eq. (2).

$\begin{matrix} {{AC}_{n} = {\frac{1}{M}{\sum\limits_{n - M + 1}^{n}\; C_{i}}}} & (2) \end{matrix}$

Though a buffer period used for calculation of the average period bit rate AS_(n) or AC_(n) is linked to the control unit time L_(n) in the preferred embodiments, setting of the buffering period is not limited to this case. For example, one past frame, a plurality of successive past frames, one past GOP, a plurality of successive past GOPs, or the like at the point of time when the coding is completed may be set as the buffering period.

A quantization step conversion factor α_(n) is a factor calculated at the point of time when the (n−1) period is ended. By multiplying a value P, which is a quantization step value of the first stream or a value calculated from the quantization step value of the first stream, by the quantization step conversion factor α_(n), a quantization step value Q of the second stream is determined. This relation is expressed by Eq. (3).

Q=α_(n)P  (3)

Referring back to FIG. 1, the CPU 11 acquires a bit rate s_b for each picture of the first stream from the decoder 12 and stores the bit rate s_b into the buffer memory 16. The CPU 11 calculates the average input bit rate S_(n) and the average period bit rate AS_(n) of the n period on the basis of the bit rate s_b stored in the buffer memory 16.

The decoder 12 outputs a quantization step value P for each macroblock of the first stream to the step value calculation part 14.

The CPU 11 acquires a bit rate c_b for each picture of the converted second stream from the encoder 15 and stores the bit rate c_b into the buffer memory 16. The CPU 11 calculates the average output bit rate C_(n) and the average period bit rate AC_(n) of the n period on the basis of the bit rate c_b stored in the buffer memory 16.

The CPU 11 further acquires the total target bit rate T set by the user.

The CPU 11 uses information such as the total target bit rate T, the average output bit rate C_(n), the average period bit rate AC_(n), the average input bit rate S_(n), and the average period bit rate AS_(n) to determine a target setting bit rate T_(n+1) of the second stream in the (n+1) period. A method of calculating the target setting bit rate T_(n+1) will be discussed in the next section <3. Exemplary Calculation of Target Bit Rate>.

Further, the CPU 11 calculates a quantization step conversion factor α_(n+1) from the target setting bit rate T_(n+1) of the second stream in the (n+1) period by using a function f which is a characteristic feature of the present invention and outputs the quantization step conversion factor α_(n+1) to the step value calculation part 14. The function f will be described later in the section <4. Calculation of Conversion Factor>.

The step value calculation part 14 inputs the quantization step value P and the quantization step conversion factor α_(n+1) and performs the computation expressed by Eq. (3) to calculate the quantization step value Q of the second stream. The step value calculation part 14 gives the calculated quantization step value Q to the encoder 15.

The encoder 15 encodes the uncompressed image data on the basis of the quantization step value Q inputted from the step value calculation part 14, to thereby generate the second stream.

<3. Exemplary Calculation of Target Bit Rate>

Next, an exemplary calculation of the target setting bit rate T_(n+1) of the second stream in the (n+1) period will be discussed. The transcoder 1 determines the target setting bit rate T_(n+1) of the second stream in the (n+1) period during the n period.

Eq. (4) is an equation for calculation of the target setting bit rate T_(n+1) of the (n+1) period. Specifically, assuming that a value obtained by dividing the average output bit rate C_(n) of the already-converted second stream in the n period by the target setting bit rate T_(n) of the n period is determined as a target ratio, the target setting bit rate T_(n+1) of the (n+1) period can be calculated by dividing the total target bit rate T of the second stream by the target ratio.

$\begin{matrix} {T_{n + 1} = {k*\frac{T}{\frac{C_{n}}{T_{n}}}}} & (4) \end{matrix}$

In Eq. (4), “k” is a positive factor and a factor for adjusting the target setting bit rate T_(n+1). Thus, a ratio of the average output bit rate to the target setting bit rate in the n period is calculated by C_(n)/T_(n), and by dividing the total target bit rate T by the target ratio, the target setting bit rate T_(n+1) of the (n+1) period is adjusted and controlled so that the bit rate should be close to the target bit rate on the whole.

Though the value obtained by dividing the average output bit rate C_(n) of the second stream in the n period by the target setting bit rate T_(n) is used as the target ratio in Eq. (4), the target ratio is further adjusted in Eq. (5).

$\begin{matrix} {T_{n + 1} = {k*\frac{T}{\frac{S_{n - 1}}{S_{n}}*\frac{C_{n}}{T_{n}}}}} & (5) \end{matrix}$

In Eq. (5), the target ratio is multiplied by S_(n−1)/S_(n). The S_(n−1)/S_(n) is a value obtained by dividing the average input bit rate S_(n−1) of the first stream in the (n−1) period by the average input bit rate S_(n) of the first stream in the n period and may be referred to as a period ratio of the average input bit rates. In other words, the target ratio is adjusted by multiplying the target ratio by the period ratio.

Thus, by multiplying the target ratio by the period ratio, it is possible to correct local variation of the target ratio. When the average input bit rate S_(n) locally decrease, for example, the target ratio C_(n)/T_(n) also accordingly decrease in some cases. Even in such a case, the target ratio is adjusted by multiplying the target ratio by the period ratio S_(n−1)/S_(n) (the period ratio takes a value larger than 1 in this case) and it is possible to avoid significant variation of the target setting bit rate T_(n+1). In the reverse case where the average input bit rate S_(n) locally increase, the period ratio S_(n−1)/S_(n) takes a value smaller than 1 and it is possible to suppress a significant increase of the target ratio.

In Eq. (5), the value obtained by dividing the average input bit rate S_(n−1) of the first stream in the (n−1) period by the average input bit rate S_(n) of the first stream in the n period is used as the period ratio. On the other hand, in a case where an average input bit rate S_(n+1) of the first stream in the (n+1) period can be obtained in advance, the average input bit rate S_(n+1) may be used. The case where the average input bit rate S_(n+1) can be obtained in advance refers to a case where there is spare time to perform buffering of information on the average input bit rate S_(n+1) and then calculate the target setting bit rate T_(n+1) of the (n+1) period. In other words, it refers to a case where a processing delay to some degree is allowed. Calculation of the target setting bit rate T_(n+1) by using the average input bit rate S_(n+1) is expressed by Eq. (6).

$\begin{matrix} {T_{n + 1} = {k*\frac{T}{\frac{S_{n}}{S_{n + 1}}*\frac{C_{n}}{T_{n}}}}} & (6) \end{matrix}$

As expressed by Eq. (6), as the period ratio, used is S_(n)/S_(n+1), i.e., a value obtained by dividing the average input bit rate S_(n) of the first stream in the n period by the average input bit rate S_(n+1) of the first stream in the (n+1) period. Thus, by using the average input bit rate S_(n+1) of the first stream in the (n+1) period, the target setting bit rate T_(n+1) can be controlled with higher accuracy. In other words, by using the latest input information, it is possible to ensure optimal control of the target bit rate.

In Eq. (5), S_(n−1)/S_(n) is used as the period ratio. Instead, a ratio between an average period bit rate AS_(n−1) for past M periods including the (n−1) period and an average period bit rate AS_(n) for past M periods including the n period may be used as the period ratio. In other words, in Eq. (5), AS_(n−1)/AS_(n) may be used as the period ratio, instead of S_(n−1)/S_(n). It is thereby possible to ensure optimal control of the target setting bit rate T_(n+1) by reducing the effect of the local variation.

Alternatively, in the case where the average input bit rate S_(n+1) of the first stream in the (n+1) period can be obtained in advance, a ratio between the average period bit rate AS_(n) for the past M periods including the n period and an average period bit rate AS_(n+1) for past M periods including the (n+1) period may be used as the period ratio. In other words, in Eq. (5), AS_(n)/AS_(n+1) may be used as the period ratio, instead of S_(n−1)/S_(n). It is thereby possible to control the target setting bit rate T_(n+1) with higher accuracy by reducing the effect of the local variation and using the latest input bit rate.

Further, an average period bit rate AC_(n) from the (n-M+1) period to the n period may be used, instead of the average output bit rate C_(n) of the n period. In other words, in the above-discussed exemplary calculation expressed by Eqs. (4) to (6) and the like, AC_(n) is used instead of C_(n). It is thereby possible to more gently control the target setting bit rate T_(n+1).

Another exemplary calculation of the target setting bit rate T_(n+1) of the (n+1) period is expressed by Eq. (7). Assuming that a value obtained by subtracting the average output bit rate C_(n) of the already-converted second stream in the n period from the target setting bit rate T_(n) of the n period is determined as a target difference, the target setting bit rate T_(n+1) of the (n+1) period can be calculated by adding the target difference to the total target bit rate T of the second stream.

T _(n+1) =T+k*(T _(n) −C _(n))  (7)

In Eq. (7), “k” is a positive factor and a factor for adjusting the target setting bit rate T_(n+1). Thus, the difference between the average output bit rate and the target setting bit rate in the n period is calculated by (T_(n)−C_(n)), and by adding the target difference to the total target bit rate T, the output stream is controlled to be close to the target bit rate.

Further, the target difference (T_(n)−C_(n)) may be multiplied by the period ratio S_(n−1)/S_(n) or the period ratio AS_(n−1)/AS_(n). Alternatively, in the case where the average input bit rate S_(n+1) can be obtained in advance, the target difference (T_(n)−C_(n)) may be multiplied by the period ratio S_(n)/S_(n+1) or the period ratio AS_(n)/AS_(n+1). Furthermore, AC_(n) may be used instead of C_(n).

<4. Calculation of Conversion Factor>

After the target setting bit rate T_(n+1) in the (n+1) period is calculated, a quantization step conversion factor α_(n+1) is calculated by performing the computation expressed by Eq. (8). Specifically, by substituting a current bit rate ratio T_(n+1)/S_(n) (=R_(B)) into the function f, the quantization step conversion factor α_(n+1) of the (n+1) period is calculated.

α_(n+1) =f(T _(n+1) /S _(n))  (8)

In Eq. (8), the function f is a function for obtaining a “ratio of quantization step values” (quantization step conversion factor) from a “ratio of bit rates”. The “ratio of bit rates” refers to a ratio of the bit rate of the second stream to the bit rate of the first stream. As the bit rate of the first stream, used is S, S_(n), or the like. As the bit rate of the second stream, used is T, T_(n) or the like. The “ratio of quantization step values” refers to a ratio of the quantization step value of the second stream to the quantization step value of the first stream. Assuming that the “ratio of bit rates” is R_(B) and the “ratio of quantization step values” is R_(Q), the function f is generally expressed by Eq. (9).

R _(Q) =f(R _(B))  (9)

An initial value α₁ of the quantization step conversion factor α_(n) is expressed by Eq. (10). Specifically, by substituting a value obtained by dividing the total target bit rate T of the second stream by the total input bit rate S of the first stream, i.e., the ratio of bit rates into the function f, obtained is the initial value α₁ of the quantization step conversion factor.

α₁ =f(T/S)  (10)

The value obtained by dividing the total target bit rate T of the second stream by the total input bit rate S of the first stream is referred to as a reference bit rate ratio R₀ as expressed by Eq. (11).

R ₀ =T/S  (11)

The function f will be described in more detail. As discussed above, the function f is a function used for calculating the quantization step conversion factor α_(n) from the “ratio of bit rates”. Eq. (12) represents a function f₁ as a function of the first preferred embodiment.

f ₁(x)=−x+R ₀ +εR ₀ ^(−δ)  (12)

The function f₁ is a straight line with an inclination of −1, passing through a point (R₀, f₀(R₀)). The function f₀ is expressed by Eq. (13). Though the function f₀ may be used as the function f, the function f₀ is used as an area specification function and a relation determining function f₁ obtained by adjusting the local inclination of the area specification function f₀ is used to calculate the quantization step conversion factor in the first preferred embodiment.

f ₀(x)=εx ^(−δ)=2.1*x ^(−1.1)  (13)

In Eq. (13), as values of ε and δ in the case of stream conversion from MPEG2 into H.264, shown are specific numerical values calculated on the basis of an experiment or the like. Specifically, as the result of the experiment, when ε=2.1 and δ=1.1, excellent characteristics can be obtained. Though the function f₀ is used in common for all the pictures in the first preferred embodiment, functions having different characteristics may be used for the picture types (I picture, P picture, and B picture).

FIG. 3 is a view showing the function f₁ and the function f₀. In FIG. 3, the x axis represents the ratio of bit rates and the y axis represents the quantization step conversion factor. As the function f₁ and the function f₀, specific values ε=2.1 and δ=1.1 are used. The function f₀ is an exponential function and has a larger inclination in an area where the ratio of bit rates is small. Assuming that the ratio of bit rates varies from about 0.4 to 0.6, in the function f₀, the quantization step conversion factor significantly varies in this area. Therefore, when the f₀ is used as the function f, the variation of the quantization step conversion factor becomes larger in the area where the ratio of bit rates is small. Then, the quantization step conversion factor is calculated by using the function f₁ of which the variation is smaller than that of the function f₀ in an area near the reference bit rate ratio R₀. FIG. 3 shows a case where the reference bit rate ratio R₀=0.5.

In other words, the area specification function f₀ serves to broadly specify an area used for determining the relation between the ratio of bit rates and the quantization step conversion factor, and in the area, the function f₁ serves to specifically determine the relation between the ratio of bit rates and the quantization step conversion factor. As discussed above, the function f₀ is obtained on the basis of the experiment or the like and can keep the relation between the ratio of bit rates and the quantization step conversion factor good in the case of stream conversion from MPEG2 into H.264. As discussed above, however, the function f₁ is used lest the variation of the quantization step conversion factor becomes larger when the ratio of bit rates ranges from about 0.4 to 0.6.

The function f₁ intersects the function f₀ at the point (R₀, f₀(R₀)). In other words, the function f₁ maintains the characteristics relatively close to those of the function f₀ near the reference bit rate ratio R₀. As the function f₁ goes farther from the point (R₀, f₀(R₀)), however, the characteristics of the function f₁ become more different from those of the function f₀. When the characteristics of the f₁ become significantly different from those of the function f₀, the characteristics of the function f₀ cannot be maintained and it is improper to continue to use the function f₁. Therefore, the function f₁ is used as far as the relation of Eq. (14) is satisfied.

|f ₀(R _(B))−f ₁(R _(B))|≦0.5  (14)

In Eq. (14), R_(B) represents a current bit rate ratio which is expressed by Eq. (15).

When the relation of Eq. (14) is not satisfied, the reference bit rate ratio R₀ is updated with the current bit rate ratio R_(B) expressed by Eq. (15).

R _(B) =T _(n+1) /S _(n)  (15)

The reference point (R₀, f₀(R₀)) is thereby updated as shown in FIG. 4, and the function f₁ is accordingly updated. Specifically, while the function f₁ is moved along the area specified by the function f₀, the quantization step conversion factor is calculated by using the function f₁. Thus, by using both the characteristics of the function f₀ and the function f₁, it is possible to ensure optimal rate control.

Though T_(n+1/S) _(n) is used as the ratio of bit rates as expressed by Eq. (8) in the above-discussed preferred embodiment, the quantization step conversion factor α_(n+1) may be calculated by using the average period bit rate AS_(n) from the (n-M+1) period to the n period as expressed by Eq. (16) instead of the average input bit rate S_(n) of the n period.

α_(n+1) =f(T _(n+1) /AS _(n))  (16)

In the process of calculating the target setting bit rate T_(n+1), in the case of using the average input bit rate S_(n+1) of the first stream in the (n+1) period as expressed by Eq. (6), as expressed by Eq. (17) instead of Eq. (8), by substituting the ratio between the target setting bit rate T_(n+1) of the (n+1) period and the average input bit rate S_(n+1) of the (n+1) period into the function f (function f₁), the quantization step conversion factor α_(n+1) of the (n+1) period can be calculated.

α_(n+1) =f(T _(n+1) /S _(n+1))  (17)

In the process of calculating the target setting bit rate T_(n+1), in the case of using the average period bit rate AS_(n+1) for past M periods including the (n+1) period, as expressed by Eq. (18) instead of Eq. (16), by substituting the ratio between the target setting bit rate T_(n+1) of the (n+1) period and the average period bit rate AS_(n+1) for past M periods including the (n+1) period into the function f (function f₁), the quantization step conversion factor α_(n+1) of the (n+1) period can be calculated.

α_(n+1) =f(T _(n+1) /AS _(n+1))  (18)

Though the inclination of the function f₁ is −1 in the first preferred embodiment, this is only one exemplary case. Optimal one among negative inclinations where the variation of the function f₁ is smaller than that of the function f₀ has only to be selected. Further, though the threshold value is set to be 0.5 in Eq. (14), this is also only one exemplary case. By freely setting the threshold value, it is possible to freely set an area near the reference bit rate ratio R₀(similarly, the updated reference bit rate ratio R₀).

The Second Preferred Embodiment

Next, the second preferred embodiment of the present invention will be discussed. The second preferred embodiment is different from the first preferred embodiment in the function f. Eq. (19) represents a function f₂ to be used as the function fin the second preferred embodiment.

$\begin{matrix} {{f_{2}(x)} = {\frac{R_{0}^{2}}{x} - R_{0} + {ɛ\; R_{0}^{- \delta}}}} & (19) \end{matrix}$

The function f₂ is a rectangular hyperbola passing through the point (R₀, f₀(R₀)) and having a tangential line p(x) with an inclination of −1 at the point (R₀, f₀(R₀)). The function f₀ is the same as that expressed by Eq. (13).

FIG. 5 is a view showing the function f₂ and the function f₀. In FIG. 5, the x axis represents the ratio of bit rates and the y axis represents the quantization step conversion factor. As the function f₂ and the function f₀, specific values ε=2.1 and δ=1.1 are used. As discussed above, the function f₀ is an exponential function and has a larger inclination in an area where the ratio of bit rates is small. Then, the quantization step conversion factor is calculated by using the function f₂ of which the variation is smaller than that of the function f₀ in an area near the reference bit rate ratio R₀.

Like in the first preferred embodiment, the f₀ serves as the area specification function for broadly specifying an area used for determining the relation between the ratio of bit rates and the quantization step conversion factor, and in the area, the function f₂ serves as the relation determining function for specifically determining the relation between the ratio of bit rates and the quantization step conversion factor.

The function f₂ intersects the function f₀ at the point (R₀, f₀(R₀)). In other words, the function f₂ maintains the characteristics relatively close to those of the function f₀ near the reference bit rate ratio R₀. As the function f₂ goes farther from the point (R₀, f₀(R₀)), however, the characteristics of the function f₂ become more different from those of the function f₀. When the characteristics of the f₂ become significantly different from those of the function f₀, the characteristics of the function f₀ cannot be maintained and it is improper to continue to use the function f₂. Therefore, the function f₂ is used as far as the relation of Eq. (20) is satisfied.

|f ₀(R _(B))−f ₂(R _(B))|≦0.5  (20)

When the relation of Eq. (20) is not satisfied, the reference bit rate ratio R₀ is updated with the current bit rate ratio R_(B) expressed by Eq. (15). The reference point (R₀, f₀(R₀)) is thereby updated, and the function f₂ is accordingly updated. Specifically, while the function f₂ is moved along the area of the function f₀, the quantization step conversion factor is calculated by using the function f₂. Thus, by using both the characteristics of the function f₀ and the function f₂, it is possible to ensure optimal rate control.

Though the inclination of the tangential line p(x) is −1 in the second preferred embodiment, this is only one exemplary case. Optimal one among negative inclinations where the variation of the function f₂ is smaller than that of the function f₀ has only to be selected. Further, though the threshold value is set to be 0.5 in Eq. (20), this is also only one exemplary case. By freely setting the threshold value, it is possible to freely set an area near the reference bit rate ratio R₀(similarly, the updated reference bit rate ratio R₀).

The Third Preferred Embodiment

Next, the third preferred embodiment of the present invention will be discussed. The third preferred embodiment is different from the first preferred embodiment in the function f. Eq. (21) represents a function f₃ to be used as the function f in the third preferred embodiment.

$\begin{matrix} {{f_{3}(x)} = {{- {ɛ\delta}}\; {R_{0}^{- {({1 + \delta})}}\left( {x - {\frac{1 + \delta}{\delta}R_{0}}} \right)}}} & (21) \end{matrix}$

The function f₃ is a straight line passing through the point (R₀, f₀(R₀)) and tangent to the function f₀ at the point (R₀, f₀(R₀)). The function f₀ is the same as that expressed by Eq. (13).

FIG. 6 is a view showing the function f₃ and the function f₀. In FIG. 6, the x axis represents the ratio of bit rates and the y axis represents the quantization step conversion factor. As the function f₃ and the function f₀, specific values ε=2.1 and δ=1.1 are used.

Herein, the function f₃ has characteristics different from those of the functions f₁ and f₂. Specifically, the function f₃ so acts as to reduce the variation of the quantization step conversion factor in an area where the bit rate ratio is smaller than the point (R₀, f₀(R₀)) and so acts as to increase the variation of the quantization step conversion factor in an area where the bit rate ratio is larger than the point (R₀, f₀(R₀)).

Like in the first and second preferred embodiments, the f₀ serves as the area specification function for broadly specifying an area used for determining the relation between the ratio of bit rates and the quantization step conversion factor, and in the area, the function f₃ serves as the relation determining function for specifically determining the relation between the ratio of bit rates and the quantization step conversion factor.

Further, the condition for using the function f₃ is the same as that in the first and second preferred embodiments. The function f₃ is used as far as the relation of Eq. (22) is satisfied.

|f ₀(R _(B))−f ₃(R _(B))|≦0.5  (22)

In the third preferred embodiment, however, it is preferable to make the condition for using the function f₃ more restrictive. As discussed above, the range of variation of the quantization step conversion factor becomes larger in the area where the bit rate ratio is larger than the point (R₀, f₀(R₀)) and this phenomenon becomes more remarkable as the bit rate ratio goes farther from the point (R₀, f₀(R₀)). Therefore, in Eq. (22), it is preferable that a value smaller than 0.5, i.e., 0.2 or 0.3, should be set as the threshold value and the function f₃ should be used only near the point (R₀, f₀(R₀)).

Also like in the first and second preferred embodiments, when the relation of Eq. (22) is not satisfied, the reference bit rate ratio R₀ is updated with the current bit rate ratio R_(B) expressed by Eq. (15).

{Variations 1}

In the above-discussed first to third preferred embodiments, the respective conditions for using the functions f₁, f₂, and f₃ as expressed by Eqs. (14), (20), and (22) are set. Though each of the functions is used on the same condition in the areas where the bit rate ratio is larger than the point (R₀, f₀(R₀)) and where the bit rate ratio is smaller than the point (R₀, f₀(R₀)) in Eqs. (14), (20), and (22), the condition may be changed. For example, as to the function f₁, there may be a method where Eq. (14) is used without any change in the area where the bit rate ratio is smaller than the point (R₀, f₀(R₀)) and used is Eq. (14) in which the threshold value is changed from 0.5 to 0.3 in order to make the use condition stricter in the area where the bit rate ratio is larger than the point (R₀, f₀(R₀)).

As to the function f₃, the range of variation of the quantization step conversion factor becomes larger in the area where the bit rate ratio is larger than the point (R₀, f₀(R₀)) and this phenomenon becomes more remarkable as the bit rate ratio goes farther from the point (R₀, f₀(R₀)). Then, as to the function f₃, there may be a method where Eq. (22) is used without any change in the area where the bit rate ratio is smaller than the point (R₀, f₀(R₀)) and used is Eq. (22) in which the threshold value is changed from 0.5 to 0.2 in order to make the use condition stricter in the area where the bit rate ratio is larger than the point (R₀, f₀(R₀)). Since the function f₃ is a tangential line of the function f₀, the function f₃ has characteristics relatively close to those of the function f₀ and is given a variation characteristic gentler than that of the function f₀ in the area where the bit rate ratio is smaller than the point (R₀, f₀(R₀)). In the area where the bit rate ratio is larger than the point (R₀, f₀(R₀)), by using the function f₃ only very near the point (R₀, f₀(R₀)), it is possible to prevent the characteristics of the function f₃ from becoming significantly different from those of the function f₀.

Different functions may be used with the point (R₀, f₀(R₀)) as the boundary. For example, the function f₃ is used in the area where the bit rate ratio is smaller than the point (R₀, f₀(R₀)) and the function f₂ is used in the area where the bit rate ratio is larger than the point (R₀, f₀(R₀)). When the function f₃ is used in the area where the bit rate ratio is smaller than the point (R₀, f₀(R₀)), the function f₃ has characteristics relatively close to those of the function f₀ and is given a variation characteristic gentler than that of the function f₀. When the function f₂ is used in the area where the bit rate ratio is larger than the point (R₀, f₀(R₀)), the function f₂ has characteristics not significantly different from those of the function f₀ and is given a gentler variation characteristic.

Alternatively, there may be a case where the function f₁ or f₂ is used in the area where the bit rate ratio is smaller than the point (R₀, f₀(R₀)) and the function f₀ is used in the area where the bit rate ratio is larger than the point (R₀, f₀(R₀)).

While the present invention has been described with reference to the particular illustrative embodiments, it is not to be restricted by the embodiments but only by the appended claims. It is to be appreciated that those skilled in the art can change or modify the embodiments without departing from the scope and spirit of the present invention. 

1. A transcoder for converting a first stream into a second stream, comprising: a conversion value calculation part for calculating a quantization step conversion value of said first and second streams from a ratio of bit rates of said first and second streams; and a quantization step value calculation part for calculating a quantization step value of said second stream by multiplying a quantization step value of said first stream by said quantization step conversion value, wherein said conversion value calculation part calculates said quantization step conversion value from said ratio of bit rates by using an area specification function for specifying an area to which a relation between said ratio of bit rates and said quantization step conversion value belongs and a relation determining function for determining a specific relation between said ratio of bit rates and said quantization step conversion value in said area.
 2. The transcoder according to claim 1, wherein assuming that a ratio between a total bit rate of said first stream and a total target bit rate of said second stream is determined as a reference bit rate ratio, said area specification function and said relation determining function have the same said quantization step conversion value on said reference bit rate ratio.
 3. The transcoder according to claim 2, wherein assuming that a ratio between a bit rate of a converted first stream in a past period and a target bit rate of a second stream is determined as a current bit rate ratio, in a case where a difference between said quantization step conversion value calculated for said current bit rate ratio by using said area specification function and said quantization step conversion value calculated for said current bit rate ratio by using said relation determining function exceeds a predetermined threshold value, said reference bit rate ratio is updated with said current bit rate ratio.
 4. The transcoder according to claim 2, wherein a rate of change of said relation determining function is smaller than that of said area specification function near said reference bit rate ratio.
 5. The transcoder according to claim 4, wherein said area specification function includes a monotone decreasing exponential function.
 6. The transcoder according to claim 4, wherein said relation determining function is a straight line with a negative inclination, intersecting said area specification function at said reference bit rate ratio.
 7. The transcoder according to claim 4, wherein said relation determining function is a hyperbola intersecting said area specification function at said reference bit rate ratio and having a tangential line with a negative inclination at said reference bit rate ratio.
 8. The transcoder according to claim 4, wherein said relation determining function is a straight line tangent to said area specification function at said reference bit rate ratio. 